import React from 'react';
import Formuser, { isProps } from './form_user';
import { Form } from 'antd';
import { connect } from 'dva';
import moment from 'moment';

export default connect(({ pay, order }: any) => ({
  auth: pay.view,
  personData: order.personData,
  commodityData: order.commodityData,
  utilsData: order.utilsData,
}))(
  Form.create({
    mapPropsToFields(props: isProps) {
      return {
        wineId: Form.createFormField({
          value: props.auth.wineId,
        }),
        payer: Form.createFormField({
          value: props.auth.payer,
        }),
        qty: Form.createFormField({
          value: props.auth.qty,
        }),
        comments: Form.createFormField({
          value: props.auth.comments,
        }),
        payee: Form.createFormField({
          value: props.auth.payee,
        }),
        payAmount: Form.createFormField({
          value: props.auth.payAmount,
        }),
        dealTime: Form.createFormField({
          value: moment(props.auth.dealTime),
        }),
        proofPhotoUrl: Form.createFormField({
          value: props.auth.proofPhotoUrl,
        }),
      };
    },
  })(Formuser),
);
